<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 702
</span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if __GLASGOW_HASKELL__ &gt;= 710
</span><span class="hs-pragma">{-# LANGUAGE AutoDeriveTypeable #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Module      :  Control.Monad.Trans.Accum</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Copyright   :  (c) Nickolay Kudasov 2016</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- License     :  BSD-style (see the file LICENSE)</span><span>
</span><span id="line-13"></span><span class="hs-comment">--</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Maintainer  :  R.Paterson@city.ac.uk</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- The lazy 'AccumT' monad transformer, which adds accumulation</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- capabilities (such as declarations or document patches) to a given monad.</span><span>
</span><span id="line-20"></span><span class="hs-comment">--</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- This monad transformer provides append-only accumulation</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- during the computation. For more general access, use</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- &quot;Control.Monad.Trans.State&quot; instead.</span><span>
</span><span id="line-24"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Control.Monad.Trans.Accum</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-27"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The Accum monad</span></span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier">Accum</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#accum"><span class="hs-identifier">accum</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#runAccum"><span class="hs-identifier">runAccum</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#execAccum"><span class="hs-identifier">execAccum</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#evalAccum"><span class="hs-identifier">evalAccum</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#mapAccum"><span class="hs-identifier">mapAccum</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The AccumT monad transformer</span></span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier">AccumT</span></a></span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier">AccumT</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier">runAccumT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#execAccumT"><span class="hs-identifier">execAccumT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#evalAccumT"><span class="hs-identifier">evalAccumT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#mapAccumT"><span class="hs-identifier">mapAccumT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Accum operations</span></span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#look"><span class="hs-identifier">look</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#looks"><span class="hs-identifier">looks</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#add"><span class="hs-identifier">add</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Lifting other operations</span></span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCallCC"><span class="hs-identifier">liftCallCC</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCallCC%27"><span class="hs-identifier">liftCallCC'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCatch"><span class="hs-identifier">liftCatch</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftListen"><span class="hs-identifier">liftListen</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftPass"><span class="hs-identifier">liftPass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Monad transformations</span></span><span>
</span><span id="line-51"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#readerToAccumT"><span class="hs-identifier">readerToAccumT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-52"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#writerToAccumT"><span class="hs-identifier">writerToAccumT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#accumToStateT"><span class="hs-identifier">accumToStateT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html"><span class="hs-identifier">Control.Monad.Trans.Class</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Reader.html"><span class="hs-identifier">Control.Monad.Trans.Reader</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier">ReaderT</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.html"><span class="hs-identifier">Control.Monad.Trans.Writer</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier">WriterT</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.State.html"><span class="hs-identifier">Control.Monad.Trans.State</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.State.Lazy.html#StateT"><span class="hs-identifier">StateT</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#"><span class="hs-identifier">Control.Monad.Fail</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Fail</span></span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#"><span class="hs-identifier">Control.Monad.Fix</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html"><span class="hs-identifier">Control.Monad.Signatures</span></a></span><span class="hs-cpp">
#if !MIN_VERSION_base(4,8,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Monoid</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-74"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-75"></span><span class="hs-comment">-- | An accumulation monad parameterized by the type @w@ of output to accumulate.</span><span>
</span><span id="line-76"></span><span class="hs-comment">--</span><span>
</span><span id="line-77"></span><span class="hs-comment">-- The 'return' function produces the output 'mempty', while @&gt;&gt;=@</span><span>
</span><span id="line-78"></span><span class="hs-comment">-- combines the outputs of the subcomputations using 'mappend'.</span><span>
</span><span id="line-79"></span><span class="hs-keyword">type</span><span> </span><span id="Accum"><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier hs-var">Accum</span></a></span></span><span> </span><span id="local-6989586621679083786"><span class="annot"><a href="#local-6989586621679083786"><span class="hs-identifier hs-type">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083786"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-type">Identity</span></a></span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="hs-comment">-- | Construct an accumulation computation from a (result, output) pair.</span><span>
</span><span id="line-82"></span><span class="hs-comment">-- (The inverse of 'runAccum'.)</span><span>
</span><span id="line-83"></span><span id="local-6989586621679084061"><span id="local-6989586621679084062"><span id="local-6989586621679084063"><span class="annot"><a href="Control.Monad.Trans.Accum.html#accum"><span class="hs-identifier hs-type">accum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084063"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084062"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084061"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084062"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084062"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084063"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084061"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-84"></span><span id="accum"><span class="annot"><span class="annottext">accum :: forall (m :: * -&gt; *) w a. Monad m =&gt; (w -&gt; (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#accum"><span class="hs-identifier hs-var hs-var">accum</span></a></span></span><span> </span><span id="local-6989586621679083783"><span class="annot"><span class="annottext">w -&gt; (a, w)
</span><a href="#local-6989586621679083783"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083782"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083782"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">w -&gt; (a, w)
</span><a href="#local-6989586621679083783"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083782"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-85"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#accum"><span class="hs-pragma hs-type">accum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-86"></span><span>
</span><span id="line-87"></span><span class="hs-comment">-- | Unwrap an accumulation computation as a (result, output) pair.</span><span>
</span><span id="line-88"></span><span class="hs-comment">-- (The inverse of 'accum'.)</span><span>
</span><span id="line-89"></span><span id="local-6989586621679084048"><span id="local-6989586621679084049"><span class="annot"><a href="Control.Monad.Trans.Accum.html#runAccum"><span class="hs-identifier hs-type">runAccum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier hs-type">Accum</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084049"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084048"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084049"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084048"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084049"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-90"></span><span id="runAccum"><span class="annot"><span class="annottext">runAccum :: forall w a. Accum w a -&gt; w -&gt; (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccum"><span class="hs-identifier hs-var hs-var">runAccum</span></a></span></span><span> </span><span id="local-6989586621679083781"><span class="annot"><span class="annottext">Accum w a
</span><a href="#local-6989586621679083781"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Identity (a, w) -&gt; (a, w)
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span> </span><span class="annot"><span class="annottext">(Identity (a, w) -&gt; (a, w))
-&gt; (w -&gt; Identity (a, w)) -&gt; w -&gt; (a, w)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Accum w a -&gt; w -&gt; Identity (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">Accum w a
</span><a href="#local-6989586621679083781"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-91"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#runAccum"><span class="hs-pragma hs-type">runAccum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="hs-comment">-- | Extract the output from an accumulation computation.</span><span>
</span><span id="line-94"></span><span class="hs-comment">--</span><span>
</span><span id="line-95"></span><span class="hs-comment">-- * @'execAccum' m w = 'snd' ('runAccum' m w)@</span><span>
</span><span id="line-96"></span><span id="local-6989586621679084035"><span id="local-6989586621679084036"><span class="annot"><a href="Control.Monad.Trans.Accum.html#execAccum"><span class="hs-identifier hs-type">execAccum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier hs-type">Accum</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084036"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084035"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084036"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084036"><span class="hs-identifier hs-type">w</span></a></span></span></span><span>
</span><span id="line-97"></span><span id="execAccum"><span class="annot"><span class="annottext">execAccum :: forall w a. Accum w a -&gt; w -&gt; w
</span><a href="Control.Monad.Trans.Accum.html#execAccum"><span class="hs-identifier hs-var hs-var">execAccum</span></a></span></span><span> </span><span id="local-6989586621679083778"><span class="annot"><span class="annottext">Accum w a
</span><a href="#local-6989586621679083778"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083777"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083777"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; w
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Accum w a -&gt; w -&gt; (a, w)
forall w a. Accum w a -&gt; w -&gt; (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccum"><span class="hs-identifier hs-var">runAccum</span></a></span><span> </span><span class="annot"><span class="annottext">Accum w a
</span><a href="#local-6989586621679083778"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083777"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-98"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#execAccum"><span class="hs-pragma hs-type">execAccum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-99"></span><span>
</span><span id="line-100"></span><span class="hs-comment">-- | Evaluate an accumulation computation with the given initial output history</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- and return the final value, discarding the final output.</span><span>
</span><span id="line-102"></span><span class="hs-comment">--</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- * @'evalAccum' m w = 'fst' ('runAccum' m w)@</span><span>
</span><span id="line-104"></span><span id="local-6989586621679084029"><span id="local-6989586621679084030"><span class="annot"><a href="Control.Monad.Trans.Accum.html#evalAccum"><span class="hs-identifier hs-type">evalAccum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084030"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier hs-type">Accum</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084030"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084029"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084030"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084029"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-105"></span><span id="evalAccum"><span class="annot"><span class="annottext">evalAccum :: forall w a. Monoid w =&gt; Accum w a -&gt; w -&gt; a
</span><a href="Control.Monad.Trans.Accum.html#evalAccum"><span class="hs-identifier hs-var hs-var">evalAccum</span></a></span></span><span> </span><span id="local-6989586621679083775"><span class="annot"><span class="annottext">Accum w a
</span><a href="#local-6989586621679083775"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083774"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083774"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; a
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Accum w a -&gt; w -&gt; (a, w)
forall w a. Accum w a -&gt; w -&gt; (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccum"><span class="hs-identifier hs-var">runAccum</span></a></span><span> </span><span class="annot"><span class="annottext">Accum w a
</span><a href="#local-6989586621679083775"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083774"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-106"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#evalAccum"><span class="hs-pragma hs-type">evalAccum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-comment">-- | Map both the return value and output of a computation using</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- the given function.</span><span>
</span><span id="line-110"></span><span class="hs-comment">--</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- * @'runAccum' ('mapAccum' f m) = f . 'runAccum' m@</span><span>
</span><span id="line-112"></span><span id="local-6989586621679084022"><span id="local-6989586621679084023"><span id="local-6989586621679084024"><span class="annot"><a href="Control.Monad.Trans.Accum.html#mapAccum"><span class="hs-identifier hs-type">mapAccum</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084024"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084023"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084022"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084023"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier hs-type">Accum</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084023"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084024"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#Accum"><span class="hs-identifier hs-type">Accum</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084023"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084022"><span class="hs-identifier hs-type">b</span></a></span></span></span></span><span>
</span><span id="line-113"></span><span id="mapAccum"><span class="annot"><span class="annottext">mapAccum :: forall a w b. ((a, w) -&gt; (b, w)) -&gt; Accum w a -&gt; Accum w b
</span><a href="Control.Monad.Trans.Accum.html#mapAccum"><span class="hs-identifier hs-var hs-var">mapAccum</span></a></span></span><span> </span><span id="local-6989586621679083773"><span class="annot"><span class="annottext">(a, w) -&gt; (b, w)
</span><a href="#local-6989586621679083773"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Identity (a, w) -&gt; Identity (b, w))
-&gt; AccumT w Identity a -&gt; AccumT w Identity b
forall (m :: * -&gt; *) a w (n :: * -&gt; *) b.
(m (a, w) -&gt; n (b, w)) -&gt; AccumT w m a -&gt; AccumT w n b
</span><a href="Control.Monad.Trans.Accum.html#mapAccumT"><span class="hs-identifier hs-var">mapAccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(b, w) -&gt; Identity (b, w)
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="annot"><span class="annottext">((b, w) -&gt; Identity (b, w))
-&gt; (Identity (a, w) -&gt; (b, w))
-&gt; Identity (a, w)
-&gt; Identity (b, w)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; (b, w)
</span><a href="#local-6989586621679083773"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; (b, w))
-&gt; (Identity (a, w) -&gt; (a, w)) -&gt; Identity (a, w) -&gt; (b, w)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Identity (a, w) -&gt; (a, w)
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-114"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#mapAccum"><span class="hs-pragma hs-type">mapAccum</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- | An accumulation monad parameterized by:</span><span>
</span><span id="line-118"></span><span class="hs-comment">--</span><span>
</span><span id="line-119"></span><span class="hs-comment">--   * @w@ - the output to accumulate.</span><span>
</span><span id="line-120"></span><span class="hs-comment">--</span><span>
</span><span id="line-121"></span><span class="hs-comment">--   * @m@ - The inner monad.</span><span>
</span><span id="line-122"></span><span class="hs-comment">--</span><span>
</span><span id="line-123"></span><span class="hs-comment">-- The 'return' function produces the output 'mempty', while @&gt;&gt;=@</span><span>
</span><span id="line-124"></span><span class="hs-comment">-- combines the outputs of the subcomputations using 'mappend'.</span><span>
</span><span id="line-125"></span><span class="hs-comment">--</span><span>
</span><span id="line-126"></span><span class="hs-comment">-- This monad transformer is similar to both state and writer monad transformers.</span><span>
</span><span id="line-127"></span><span class="hs-comment">-- Thus it can be seen as</span><span>
</span><span id="line-128"></span><span class="hs-comment">--</span><span>
</span><span id="line-129"></span><span class="hs-comment">--  * a restricted append-only version of a state monad transformer or</span><span>
</span><span id="line-130"></span><span class="hs-comment">--</span><span>
</span><span id="line-131"></span><span class="hs-comment">--  * a writer monad transformer with the extra ability to read all previous output.</span><span>
</span><span id="line-132"></span><span class="hs-keyword">newtype</span><span> </span><span id="AccumT"><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span></span><span> </span><span id="local-6989586621679084057"><span class="annot"><a href="#local-6989586621679084057"><span class="hs-identifier hs-type">w</span></a></span></span><span> </span><span id="local-6989586621679084056"><span class="annot"><a href="#local-6989586621679084056"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679084055"><span class="annot"><a href="#local-6989586621679084055"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="AccumT"><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084057"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084056"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084055"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084057"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-133"></span><span>
</span><span id="line-134"></span><span class="hs-comment">-- | Unwrap an accumulation computation.</span><span>
</span><span id="line-135"></span><span id="local-6989586621679084037"><span id="local-6989586621679084038"><span id="local-6989586621679084039"><span class="annot"><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-type">runAccumT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084039"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084038"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084037"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084039"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084038"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084037"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084039"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span><span>
</span><span id="line-136"></span><span id="runAccumT"><span class="annot"><span class="annottext">runAccumT :: forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var hs-var">runAccumT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span id="local-6989586621679083771"><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679083771"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, w)
</span><a href="#local-6989586621679083771"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-137"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-pragma hs-type">runAccumT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span class="hs-comment">-- | Extract the output from an accumulation computation.</span><span>
</span><span id="line-140"></span><span class="hs-comment">--</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- * @'execAccumT' m w = 'liftM' 'snd' ('runAccumT' m w)@</span><span>
</span><span id="line-142"></span><span id="local-6989586621679084007"><span id="local-6989586621679084008"><span id="local-6989586621679084009"><span class="annot"><a href="Control.Monad.Trans.Accum.html#execAccumT"><span class="hs-identifier hs-type">execAccumT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084009"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084008"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084009"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084007"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084008"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084009"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084008"><span class="hs-identifier hs-type">w</span></a></span></span></span></span><span>
</span><span id="line-143"></span><span id="execAccumT"><span class="annot"><span class="annottext">execAccumT :: forall (m :: * -&gt; *) w a. Monad m =&gt; AccumT w m a -&gt; w -&gt; m w
</span><a href="Control.Monad.Trans.Accum.html#execAccumT"><span class="hs-identifier hs-var hs-var">execAccumT</span></a></span></span><span> </span><span id="local-6989586621679083767"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083767"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083766"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083766"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083765"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083765"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083767"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083766"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-145"></span><span>    </span><span class="annot"><span class="annottext">w -&gt; m w
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083765"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-146"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#execAccumT"><span class="hs-pragma hs-type">execAccumT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span class="hs-comment">-- | Evaluate an accumulation computation with the given initial output history</span><span>
</span><span id="line-149"></span><span class="hs-comment">-- and return the final value, discarding the final output.</span><span>
</span><span id="line-150"></span><span class="hs-comment">--</span><span>
</span><span id="line-151"></span><span class="hs-comment">-- * @'evalAccumT' m w = 'liftM' 'fst' ('runAccumT' m w)@</span><span>
</span><span id="line-152"></span><span id="local-6989586621679084001"><span id="local-6989586621679084002"><span id="local-6989586621679084003"><span class="annot"><a href="Control.Monad.Trans.Accum.html#evalAccumT"><span class="hs-identifier hs-type">evalAccumT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084003"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084002"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084002"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084003"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084001"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084002"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084003"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084001"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-153"></span><span id="evalAccumT"><span class="annot"><span class="annottext">evalAccumT :: forall (m :: * -&gt; *) w a.
(Monad m, Monoid w) =&gt;
AccumT w m a -&gt; w -&gt; m a
</span><a href="Control.Monad.Trans.Accum.html#evalAccumT"><span class="hs-identifier hs-var hs-var">evalAccumT</span></a></span></span><span> </span><span id="local-6989586621679083760"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083760"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083759"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083759"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083758"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083758"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083760"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083759"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-155"></span><span>    </span><span class="annot"><span class="annottext">a -&gt; m a
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083758"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-156"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#evalAccumT"><span class="hs-pragma hs-type">evalAccumT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-157"></span><span>
</span><span id="line-158"></span><span class="hs-comment">-- | Map both the return value and output of a computation using</span><span>
</span><span id="line-159"></span><span class="hs-comment">-- the given function.</span><span>
</span><span id="line-160"></span><span class="hs-comment">--</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- * @'runAccumT' ('mapAccumT' f m) = f . 'runAccumT' m@</span><span>
</span><span id="line-162"></span><span id="local-6989586621679084014"><span id="local-6989586621679084015"><span id="local-6989586621679084016"><span id="local-6989586621679084017"><span id="local-6989586621679084018"><span class="annot"><a href="Control.Monad.Trans.Accum.html#mapAccumT"><span class="hs-identifier hs-type">mapAccumT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084018"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084017"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084016"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679084015"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679084014"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679084016"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084016"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084018"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084017"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084016"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084015"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679084014"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span><span>
</span><span id="line-163"></span><span id="mapAccumT"><span class="annot"><span class="annottext">mapAccumT :: forall (m :: * -&gt; *) a w (n :: * -&gt; *) b.
(m (a, w) -&gt; n (b, w)) -&gt; AccumT w m a -&gt; AccumT w n b
</span><a href="Control.Monad.Trans.Accum.html#mapAccumT"><span class="hs-identifier hs-var hs-var">mapAccumT</span></a></span></span><span> </span><span id="local-6989586621679083757"><span class="annot"><span class="annottext">m (a, w) -&gt; n (b, w)
</span><a href="#local-6989586621679083757"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679083756"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083756"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; n (b, w)) -&gt; AccumT w n b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">m (a, w) -&gt; n (b, w)
</span><a href="#local-6989586621679083757"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">(m (a, w) -&gt; n (b, w)) -&gt; (w -&gt; m (a, w)) -&gt; w -&gt; n (b, w)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083756"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#mapAccumT"><span class="hs-pragma hs-type">mapAccumT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span id="local-6989586621679083986"><span id="local-6989586621679083987"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679083753"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083987"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083986"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083987"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-167"></span><span>    </span><span id="local-6989586621679083750"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; AccumT w m a -&gt; AccumT w m b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span id="local-6989586621679083749"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679083749"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(m (a, w) -&gt; m (b, w)) -&gt; AccumT w m a -&gt; AccumT w m b
forall (m :: * -&gt; *) a w (n :: * -&gt; *) b.
(m (a, w) -&gt; n (b, w)) -&gt; AccumT w m a -&gt; AccumT w n b
</span><a href="Control.Monad.Trans.Accum.html#mapAccumT"><span class="hs-identifier hs-var">mapAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((m (a, w) -&gt; m (b, w)) -&gt; AccumT w m a -&gt; AccumT w m b)
-&gt; (m (a, w) -&gt; m (b, w)) -&gt; AccumT w m a -&gt; AccumT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; (b, w)) -&gt; m (a, w) -&gt; m (b, w)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">(((a, w) -&gt; (b, w)) -&gt; m (a, w) -&gt; m (b, w))
-&gt; ((a, w) -&gt; (b, w)) -&gt; m (a, w) -&gt; m (b, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083748"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083748"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083747"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083747"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679083749"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083748"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083747"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-pragma hs-type">fmap</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span id="local-6989586621679083971"><span id="local-6989586621679083972"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679083737"><span id="local-6989586621679083739"><span id="local-6989586621679083741"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083972"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083971"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083971"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083972"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083971"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-171"></span><span>    </span><span id="local-6989586621679083733"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; AccumT w m a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621679083732"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083732"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(m (a, w) -&gt; w -&gt; m (a, w)) -&gt; m (a, w) -&gt; w -&gt; m (a, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083732"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-172"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#pure"><span class="hs-pragma hs-type">pure</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-173"></span><span>    </span><span id="local-6989586621679083725"><span class="annot"><span class="annottext">AccumT w m (a -&gt; b)
</span><a href="#local-6989586621679083725"><span class="hs-identifier hs-var">mf</span></a></span></span><span> </span><span id="local-6989586621679083724"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b. AccumT w m (a -&gt; b) -&gt; AccumT w m a -&gt; AccumT w m b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span id="local-6989586621679083723"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083723"><span class="hs-identifier hs-var">mv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; AccumT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; AccumT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; AccumT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083722"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083722"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-174"></span><span>      </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083721"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679083721"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083720"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083720"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT w m (a -&gt; b) -&gt; w -&gt; m (a -&gt; b, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m (a -&gt; b)
</span><a href="#local-6989586621679083725"><span class="hs-identifier hs-var">mf</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083722"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-175"></span><span>      </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083719"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083719"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083718"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083718"><span class="hs-identifier hs-var">w''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083723"><span class="hs-identifier hs-var">mv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083722"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083720"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-176"></span><span>      </span><span class="annot"><span class="annottext">(b, w) -&gt; m (b, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679083721"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083719"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083720"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083718"><span class="hs-identifier hs-var">w''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;*&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-178"></span><span>
</span><span id="line-179"></span><span id="local-6989586621679083958"><span id="local-6989586621679083959"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679083710"><span id="local-6989586621679083712"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083959"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083958"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083958"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Alternative"><span class="hs-identifier hs-type">Alternative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083959"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083958"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-180"></span><span>    </span><span id="local-6989586621679083707"><span class="annot"><span class="annottext">empty :: forall a. AccumT w m a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var hs-var hs-var hs-var">empty</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a
</span><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-identifier hs-var">mzero</span></a></span><span>
</span><span id="line-181"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-182"></span><span>    </span><span id="local-6989586621679083703"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083703"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083702"><span class="annot"><span class="annottext">&lt;|&gt; :: forall a. AccumT w m a -&gt; AccumT w m a -&gt; AccumT w m a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;|&gt;</span></a></span></span><span> </span><span id="local-6989586621679083700"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083700"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083699"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083699"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083703"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083699"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; m (a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083700"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083699"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-183"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;|&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-184"></span><span>
</span><span id="line-185"></span><span id="local-6989586621679083948"><span id="local-6989586621679083949"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679083691"><span id="local-6989586621679083693"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083949"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083948"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083948"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083949"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083948"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,8,0))
</span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">a</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">AccumT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mempty</span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">return</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>    </span><span id="local-6989586621679083684"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083684"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083683"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b. AccumT w m a -&gt; (a -&gt; AccumT w m b) -&gt; AccumT w m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&gt;&gt;=</span></a></span></span><span> </span><span id="local-6989586621679083682"><span class="annot"><span class="annottext">a -&gt; AccumT w m b
</span><a href="#local-6989586621679083682"><span class="hs-identifier hs-var">k</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; AccumT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; AccumT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; AccumT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083681"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083681"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-191"></span><span>        </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083680"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083680"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083679"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083679"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083684"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083681"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-192"></span><span>        </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083678"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679083678"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083677"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083677"><span class="hs-identifier hs-var">w''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT w m b -&gt; w -&gt; m (b, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; AccumT w m b
</span><a href="#local-6989586621679083682"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083680"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083681"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083679"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>        </span><span class="annot"><span class="annottext">(b, w) -&gt; m (b, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679083678"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083679"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083677"><span class="hs-identifier hs-var">w''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&gt;&gt;=</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,13,0))
</span><span>    </span><span class="hs-identifier">fail</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">AccumT</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fail</span><span> </span><span class="hs-identifier">msg</span><span class="hs-special">)</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">fail</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span id="local-6989586621679083940"><span id="local-6989586621679083941"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083941"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083940"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083941"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083940"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-202"></span><span>    </span><span id="local-6989586621679083662"><span class="annot"><span class="annottext">fail :: forall a. String -&gt; AccumT w m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var hs-var hs-var hs-var">fail</span></a></span></span><span> </span><span id="local-6989586621679083661"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679083661"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadFail m =&gt; String -&gt; m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var">Fail.fail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679083661"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-203"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-pragma hs-type">fail</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-206"></span><span id="local-6989586621679083935"><span id="local-6989586621679083936"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083936"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083935"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083935"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083936"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083935"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-207"></span><span>    </span><span id="local-6989586621679083647"><span class="annot"><span class="annottext">mzero :: forall a. AccumT w m a
</span><a href="#local-6989586621679083647"><span class="hs-identifier hs-var hs-var hs-var hs-var">mzero</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a
</span><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-identifier hs-var">mzero</span></a></span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-pragma hs-type">mzero</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-209"></span><span>    </span><span id="local-6989586621679083645"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083645"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083644"><span class="annot"><span class="annottext">mplus :: forall a. AccumT w m a -&gt; AccumT w m a -&gt; AccumT w m a
</span><a href="#local-6989586621679083644"><span class="hs-operator hs-var hs-var hs-var hs-var">`mplus`</span></a></span></span><span> </span><span id="local-6989586621679083643"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083643"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083642"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083642"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083645"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083642"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; m (a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083643"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083642"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-pragma hs-type">mplus</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span id="local-6989586621679083927"><span id="local-6989586621679083928"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083928"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083927"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#MonadFix"><span class="hs-identifier hs-type">MonadFix</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083927"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#MonadFix"><span class="hs-identifier hs-type">MonadFix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083928"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083927"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-213"></span><span>    </span><span id="local-6989586621679083630"><span class="annot"><span class="annottext">mfix :: forall a. (a -&gt; AccumT w m a) -&gt; AccumT w m a
</span><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-identifier hs-var hs-var hs-var hs-var">mfix</span></a></span></span><span> </span><span id="local-6989586621679083629"><span class="annot"><span class="annottext">a -&gt; AccumT w m a
</span><a href="#local-6989586621679083629"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083628"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083628"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((a, w) -&gt; m (a, w)) -&gt; m (a, w)
forall (m :: * -&gt; *) a. MonadFix m =&gt; (a -&gt; m a) -&gt; m a
</span><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-identifier hs-var">mfix</span></a></span><span> </span><span class="annot"><span class="annottext">(((a, w) -&gt; m (a, w)) -&gt; m (a, w))
-&gt; ((a, w) -&gt; m (a, w)) -&gt; m (a, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083627"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083627"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; AccumT w m a
</span><a href="#local-6989586621679083629"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083627"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083628"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-pragma hs-type">mfix</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span id="local-6989586621679083920"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083920"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#MonadTrans"><span class="hs-identifier hs-type">MonadTrans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083920"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-217"></span><span>    </span><span id="local-6989586621679083618"><span class="annot"><span class="annottext">lift :: forall (m :: * -&gt; *) a. Monad m =&gt; m a -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var hs-var hs-var hs-var">lift</span></a></span></span><span> </span><span id="local-6989586621679083616"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679083616"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(m (a, w) -&gt; w -&gt; m (a, w)) -&gt; m (a, w) -&gt; w -&gt; m (a, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-218"></span><span>        </span><span id="local-6989586621679083615"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083615"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679083616"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-219"></span><span>        </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083615"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-pragma hs-type">lift</span></a></span><span> </span><span class="hs-pragma">#-}</span></span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span id="local-6989586621679083911"><span id="local-6989586621679083912"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083912"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083911"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083911"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083912"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083911"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-223"></span><span>    </span><span id="local-6989586621679083601"><span class="annot"><span class="annottext">liftIO :: forall a. IO a -&gt; AccumT w m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftIO</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; AccumT w m a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; AccumT w m a) -&gt; (IO a -&gt; m a) -&gt; IO a -&gt; AccumT w m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; m a
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span>
</span><span id="line-224"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-pragma hs-type">liftIO</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span class="hs-comment">-- | @'look'@ is an action that fetches all the previously accumulated output.</span><span>
</span><span id="line-227"></span><span id="local-6989586621679083908"><span id="local-6989586621679083909"><span class="annot"><a href="Control.Monad.Trans.Accum.html#look"><span class="hs-identifier hs-type">look</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083909"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083908"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083909"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083908"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083909"><span class="hs-identifier hs-type">w</span></a></span></span></span><span>
</span><span id="line-228"></span><span id="look"><span class="annot"><span class="annottext">look :: forall w (m :: * -&gt; *). (Monoid w, Monad m) =&gt; AccumT w m w
</span><a href="Control.Monad.Trans.Accum.html#look"><span class="hs-identifier hs-var hs-var">look</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (w, w)) -&gt; AccumT w m w
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (w, w)) -&gt; AccumT w m w)
-&gt; (w -&gt; m (w, w)) -&gt; AccumT w m w
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083595"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083595"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(w, w) -&gt; m (w, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083595"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="hs-comment">-- | @'look'@ is an action that retrieves a function of the previously accumulated output.</span><span>
</span><span id="line-231"></span><span id="local-6989586621679083903"><span id="local-6989586621679083904"><span id="local-6989586621679083905"><span class="annot"><a href="Control.Monad.Trans.Accum.html#looks"><span class="hs-identifier hs-type">looks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083905"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083904"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083905"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679083903"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083905"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083904"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083903"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-232"></span><span id="looks"><span class="annot"><span class="annottext">looks :: forall w (m :: * -&gt; *) a.
(Monoid w, Monad m) =&gt;
(w -&gt; a) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#looks"><span class="hs-identifier hs-var hs-var">looks</span></a></span></span><span> </span><span id="local-6989586621679083590"><span class="annot"><span class="annottext">w -&gt; a
</span><a href="#local-6989586621679083590"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083589"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083589"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">w -&gt; a
</span><a href="#local-6989586621679083590"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083589"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="hs-comment">-- | @'add' w@ is an action that produces the output @w@.</span><span>
</span><span id="line-235"></span><span id="local-6989586621679083898"><span id="local-6989586621679083899"><span class="annot"><a href="Control.Monad.Trans.Accum.html#add"><span class="hs-identifier hs-type">add</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083899"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679083898"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083898"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083899"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span><span>
</span><span id="line-236"></span><span id="add"><span class="annot"><span class="annottext">add :: forall (m :: * -&gt; *) w. Monad m =&gt; w -&gt; AccumT w m ()
</span><a href="Control.Monad.Trans.Accum.html#add"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621679083586"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083586"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; ((), w)) -&gt; AccumT w m ()
forall (m :: * -&gt; *) w a. Monad m =&gt; (w -&gt; (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#accum"><span class="hs-identifier hs-var">accum</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; ((), w)) -&gt; AccumT w m ())
-&gt; (w -&gt; ((), w)) -&gt; AccumT w m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">((), w) -&gt; w -&gt; ((), w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083586"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#add"><span class="hs-pragma hs-type">add</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-238"></span><span>
</span><span id="line-239"></span><span class="hs-comment">-- | Uniform lifting of a @callCC@ operation to the new monad.</span><span>
</span><span id="line-240"></span><span class="hs-comment">-- This version rolls back to the original output history on entering the</span><span>
</span><span id="line-241"></span><span class="hs-comment">-- continuation.</span><span>
</span><span id="line-242"></span><span id="local-6989586621679083892"><span id="local-6989586621679083893"><span id="local-6989586621679083894"><span id="local-6989586621679083895"><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCallCC"><span class="hs-identifier hs-type">liftCallCC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083895"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083894"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083893"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083892"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083893"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083893"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083895"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679083894"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083892"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span><span>
</span><span id="line-243"></span><span id="liftCallCC"><span class="annot"><span class="annottext">liftCallCC :: forall (m :: * -&gt; *) a w b.
CallCC m (a, w) (b, w) -&gt; CallCC (AccumT w m) a b
</span><a href="Control.Monad.Trans.Accum.html#liftCallCC"><span class="hs-identifier hs-var hs-var">liftCallCC</span></a></span></span><span> </span><span id="local-6989586621679083585"><span class="annot"><span class="annottext">CallCC m (a, w) (b, w)
</span><a href="#local-6989586621679083585"><span class="hs-identifier hs-var">callCC</span></a></span></span><span> </span><span id="local-6989586621679083584"><span class="annot"><span class="annottext">(a -&gt; AccumT w m b) -&gt; AccumT w m a
</span><a href="#local-6989586621679083584"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083583"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083583"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-244"></span><span>    </span><span class="annot"><span class="annottext">CallCC m (a, w) (b, w)
</span><a href="#local-6989586621679083585"><span class="hs-identifier hs-var">callCC</span></a></span><span> </span><span class="annot"><span class="annottext">CallCC m (a, w) (b, w) -&gt; CallCC m (a, w) (b, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083582"><span class="annot"><span class="annottext">(a, w) -&gt; m (b, w)
</span><a href="#local-6989586621679083582"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-245"></span><span>    </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; AccumT w m b) -&gt; AccumT w m a
</span><a href="#local-6989586621679083584"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083581"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083581"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; AccumT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; AccumT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; AccumT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (b, w)
</span><a href="#local-6989586621679083582"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083581"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083583"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083583"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-246"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCallCC"><span class="hs-pragma hs-type">liftCallCC</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="hs-comment">-- | In-situ lifting of a @callCC@ operation to the new monad.</span><span>
</span><span id="line-249"></span><span class="hs-comment">-- This version uses the current output history on entering the continuation.</span><span>
</span><span id="line-250"></span><span class="hs-comment">-- It does not satisfy the uniformity property (see &quot;Control.Monad.Signatures&quot;).</span><span>
</span><span id="line-251"></span><span id="local-6989586621679083577"><span id="local-6989586621679083578"><span id="local-6989586621679083579"><span id="local-6989586621679083580"><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCallCC%27"><span class="hs-identifier hs-type">liftCallCC'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083580"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083579"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083578"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083577"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083578"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083578"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083580"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679083579"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083577"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span><span>
</span><span id="line-252"></span><span id="liftCallCC%27"><span class="annot"><span class="annottext">liftCallCC' :: forall (m :: * -&gt; *) a w b.
CallCC m (a, w) (b, w) -&gt; CallCC (AccumT w m) a b
</span><a href="Control.Monad.Trans.Accum.html#liftCallCC%27"><span class="hs-identifier hs-var hs-var">liftCallCC'</span></a></span></span><span> </span><span id="local-6989586621679083576"><span class="annot"><span class="annottext">CallCC m (a, w) (b, w)
</span><a href="#local-6989586621679083576"><span class="hs-identifier hs-var">callCC</span></a></span></span><span> </span><span id="local-6989586621679083575"><span class="annot"><span class="annottext">(a -&gt; AccumT w m b) -&gt; AccumT w m a
</span><a href="#local-6989586621679083575"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083574"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083574"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-253"></span><span>    </span><span class="annot"><span class="annottext">CallCC m (a, w) (b, w)
</span><a href="#local-6989586621679083576"><span class="hs-identifier hs-var">callCC</span></a></span><span> </span><span class="annot"><span class="annottext">CallCC m (a, w) (b, w) -&gt; CallCC m (a, w) (b, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083573"><span class="annot"><span class="annottext">(a, w) -&gt; m (b, w)
</span><a href="#local-6989586621679083573"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-254"></span><span>    </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; AccumT w m b) -&gt; AccumT w m a
</span><a href="#local-6989586621679083575"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083572"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083572"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (b, w)) -&gt; AccumT w m b
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (b, w)) -&gt; AccumT w m b)
-&gt; (w -&gt; m (b, w)) -&gt; AccumT w m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083571"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083571"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, w) -&gt; m (b, w)
</span><a href="#local-6989586621679083573"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083572"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083571"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083574"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-255"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCallCC%27"><span class="hs-pragma hs-type">liftCallCC'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-comment">-- | Lift a @catchE@ operation to the new monad.</span><span>
</span><span id="line-258"></span><span id="local-6989586621679083879"><span id="local-6989586621679083880"><span id="local-6989586621679083881"><span id="local-6989586621679083882"><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCatch"><span class="hs-identifier hs-type">liftCatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Catch"><span class="hs-identifier hs-type">Catch</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083882"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083881"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083880"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083879"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Catch"><span class="hs-identifier hs-type">Catch</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083882"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083879"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083881"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679083880"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span><span>
</span><span id="line-259"></span><span id="liftCatch"><span class="annot"><span class="annottext">liftCatch :: forall e (m :: * -&gt; *) a w.
Catch e m (a, w) -&gt; Catch e (AccumT w m) a
</span><a href="Control.Monad.Trans.Accum.html#liftCatch"><span class="hs-identifier hs-var hs-var">liftCatch</span></a></span></span><span> </span><span id="local-6989586621679083570"><span class="annot"><span class="annottext">Catch e m (a, w)
</span><a href="#local-6989586621679083570"><span class="hs-identifier hs-var">catchE</span></a></span></span><span> </span><span id="local-6989586621679083569"><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083569"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679083568"><span class="annot"><span class="annottext">e -&gt; AccumT w m a
</span><a href="#local-6989586621679083568"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-260"></span><span>    </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083567"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083567"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT w m a
</span><a href="#local-6989586621679083569"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083567"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Catch e m (a, w)
</span><a href="#local-6989586621679083570"><span class="hs-operator hs-var">`catchE`</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083566"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679083566"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">AccumT w m a -&gt; w -&gt; m (a, w)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">e -&gt; AccumT w m a
</span><a href="#local-6989586621679083568"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679083566"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083567"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-261"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftCatch"><span class="hs-pragma hs-type">liftCatch</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-comment">-- | Lift a @listen@ operation to the new monad.</span><span>
</span><span id="line-264"></span><span id="local-6989586621679083870"><span id="local-6989586621679083871"><span id="local-6989586621679083872"><span id="local-6989586621679083873"><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftListen"><span class="hs-identifier hs-type">liftListen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083873"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Listen"><span class="hs-identifier hs-type">Listen</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083872"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083873"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083871"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083870"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Listen"><span class="hs-identifier hs-type">Listen</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083872"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083870"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083873"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679083871"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span><span>
</span><span id="line-265"></span><span id="liftListen"><span class="annot"><span class="annottext">liftListen :: forall (m :: * -&gt; *) w a s.
Monad m =&gt;
Listen w m (a, s) -&gt; Listen w (AccumT s m) a
</span><a href="Control.Monad.Trans.Accum.html#liftListen"><span class="hs-identifier hs-var hs-var">liftListen</span></a></span></span><span> </span><span id="local-6989586621679083562"><span class="annot"><span class="annottext">Listen w m (a, s)
</span><a href="#local-6989586621679083562"><span class="hs-identifier hs-var">listen</span></a></span></span><span> </span><span id="local-6989586621679083561"><span class="annot"><span class="annottext">AccumT s m a
</span><a href="#local-6989586621679083561"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; m ((a, w), s)) -&gt; AccumT s m (a, w)
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m ((a, w), s)) -&gt; AccumT s m (a, w))
-&gt; (s -&gt; m ((a, w), s)) -&gt; AccumT s m (a, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083560"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083560"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679083559"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083559"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083558"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083558"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083557"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083557"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Listen w m (a, s)
</span><a href="#local-6989586621679083562"><span class="hs-identifier hs-var">listen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AccumT s m a -&gt; s -&gt; m (a, s)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT s m a
</span><a href="#local-6989586621679083561"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083560"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span>    </span><span class="annot"><span class="annottext">((a, w), s) -&gt; m ((a, w), s)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083559"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083557"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083558"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftListen"><span class="hs-pragma hs-type">liftListen</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-269"></span><span>
</span><span id="line-270"></span><span class="hs-comment">-- | Lift a @pass@ operation to the new monad.</span><span>
</span><span id="line-271"></span><span id="local-6989586621679083861"><span id="local-6989586621679083862"><span id="local-6989586621679083863"><span id="local-6989586621679083864"><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftPass"><span class="hs-identifier hs-type">liftPass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083864"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Pass"><span class="hs-identifier hs-type">Pass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083863"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083864"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679083862"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679083861"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Pass"><span class="hs-identifier hs-type">Pass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083863"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083861"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083864"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679083862"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span><span>
</span><span id="line-272"></span><span id="liftPass"><span class="annot"><span class="annottext">liftPass :: forall (m :: * -&gt; *) w a s.
Monad m =&gt;
Pass w m (a, s) -&gt; Pass w (AccumT s m) a
</span><a href="Control.Monad.Trans.Accum.html#liftPass"><span class="hs-identifier hs-var hs-var">liftPass</span></a></span></span><span> </span><span id="local-6989586621679083553"><span class="annot"><span class="annottext">Pass w m (a, s)
</span><a href="#local-6989586621679083553"><span class="hs-identifier hs-var">pass</span></a></span></span><span> </span><span id="local-6989586621679083552"><span class="annot"><span class="annottext">AccumT s m (a, w -&gt; w)
</span><a href="#local-6989586621679083552"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; m (a, s)) -&gt; AccumT s m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m (a, s)) -&gt; AccumT s m a)
-&gt; (s -&gt; m (a, s)) -&gt; AccumT s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083551"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083551"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Pass w m (a, s)
</span><a href="#local-6989586621679083553"><span class="hs-identifier hs-var">pass</span></a></span><span> </span><span class="annot"><span class="annottext">Pass w m (a, s) -&gt; Pass w m (a, s)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-273"></span><span>    </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679083550"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083550"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083549"><span class="annot"><span class="annottext">w -&gt; w
</span><a href="#local-6989586621679083549"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083548"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083548"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AccumT s m (a, w -&gt; w) -&gt; s -&gt; m ((a, w -&gt; w), s)
forall w (m :: * -&gt; *) a. AccumT w m a -&gt; w -&gt; m (a, w)
</span><a href="Control.Monad.Trans.Accum.html#runAccumT"><span class="hs-identifier hs-var">runAccumT</span></a></span><span> </span><span class="annot"><span class="annottext">AccumT s m (a, w -&gt; w)
</span><a href="#local-6989586621679083552"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083551"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-274"></span><span>    </span><span class="annot"><span class="annottext">((a, s), w -&gt; w) -&gt; m ((a, s), w -&gt; w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083550"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083548"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w -&gt; w
</span><a href="#local-6989586621679083549"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#liftPass"><span class="hs-pragma hs-type">liftPass</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-276"></span><span>
</span><span id="line-277"></span><span class="hs-comment">-- | Convert a read-only computation into an accumulation computation.</span><span>
</span><span id="line-278"></span><span id="local-6989586621679083853"><span id="local-6989586621679083854"><span id="local-6989586621679083855"><span class="annot"><a href="Control.Monad.Trans.Accum.html#readerToAccumT"><span class="hs-identifier hs-type">readerToAccumT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083855"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083854"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier hs-type">ReaderT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083854"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083855"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083853"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083854"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083855"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083853"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-279"></span><span id="readerToAccumT"><span class="annot"><span class="annottext">readerToAccumT :: forall (m :: * -&gt; *) w a.
(Functor m, Monoid w) =&gt;
ReaderT w m a -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#readerToAccumT"><span class="hs-identifier hs-var hs-var">readerToAccumT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Reader.html#ReaderT"><span class="hs-identifier hs-type">ReaderT</span></a></span><span> </span><span id="local-6989586621679083542"><span class="annot"><span class="annottext">w -&gt; m a
</span><a href="#local-6989586621679083542"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083541"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083541"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a -&gt; (a, w)) -&gt; m a -&gt; m (a, w)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083540"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083540"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083540"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">w -&gt; m a
</span><a href="#local-6989586621679083542"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679083541"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-280"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#readerToAccumT"><span class="hs-pragma hs-type">readerToAccumT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span class="hs-comment">-- | Convert a writer computation into an accumulation computation.</span><span>
</span><span id="line-283"></span><span id="local-6989586621679083846"><span id="local-6989586621679083847"><span id="local-6989586621679083848"><span class="annot"><a href="Control.Monad.Trans.Accum.html#writerToAccumT"><span class="hs-identifier hs-type">writerToAccumT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083848"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083847"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083846"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083848"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083847"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083846"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-284"></span><span id="writerToAccumT"><span class="annot"><span class="annottext">writerToAccumT :: forall w (m :: * -&gt; *) a. WriterT w m a -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#writerToAccumT"><span class="hs-identifier hs-var hs-var">writerToAccumT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Writer.Lazy.html#WriterT"><span class="hs-identifier hs-type">WriterT</span></a></span><span> </span><span id="local-6989586621679083538"><span class="annot"><span class="annottext">m (a, w)
</span><a href="#local-6989586621679083538"><span class="hs-identifier hs-var">m</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; m (a, w)) -&gt; AccumT w m a
forall w (m :: * -&gt; *) a. (w -&gt; m (a, w)) -&gt; AccumT w m a
</span><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-var">AccumT</span></a></span><span> </span><span class="annot"><span class="annottext">((w -&gt; m (a, w)) -&gt; AccumT w m a)
-&gt; (w -&gt; m (a, w)) -&gt; AccumT w m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w) -&gt; w -&gt; m (a, w)
forall a b. a -&gt; b -&gt; a
</span><a href="../../base/src/GHC.Base.html#const"><span class="hs-identifier hs-var">const</span></a></span><span> </span><span class="annot"><span class="annottext">(m (a, w) -&gt; w -&gt; m (a, w)) -&gt; m (a, w) -&gt; w -&gt; m (a, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, w)
</span><a href="#local-6989586621679083538"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-285"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#writerToAccumT"><span class="hs-pragma hs-type">writerToAccumT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-286"></span><span>
</span><span id="line-287"></span><span class="hs-comment">-- | Convert an accumulation (append-only) computation into a fully</span><span>
</span><span id="line-288"></span><span class="hs-comment">-- stateful computation.</span><span>
</span><span id="line-289"></span><span id="local-6989586621679083839"><span id="local-6989586621679083840"><span id="local-6989586621679083841"><span class="annot"><a href="Control.Monad.Trans.Accum.html#accumToStateT"><span class="hs-identifier hs-type">accumToStateT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083841"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083840"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083840"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083841"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083839"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.State.Lazy.html#StateT"><span class="hs-identifier hs-type">StateT</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083840"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083841"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679083839"><span class="hs-identifier hs-type">a</span></a></span></span></span></span><span>
</span><span id="line-290"></span><span id="accumToStateT"><span class="annot"><span class="annottext">accumToStateT :: forall (m :: * -&gt; *) s a.
(Functor m, Monoid s) =&gt;
AccumT s m a -&gt; StateT s m a
</span><a href="Control.Monad.Trans.Accum.html#accumToStateT"><span class="hs-identifier hs-var hs-var">accumToStateT</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.Accum.html#AccumT"><span class="hs-identifier hs-type">AccumT</span></a></span><span> </span><span id="local-6989586621679083533"><span class="annot"><span class="annottext">s -&gt; m (a, s)
</span><a href="#local-6989586621679083533"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-291"></span><span>    </span><span class="annot"><span class="annottext">(s -&gt; m (a, s)) -&gt; StateT s m a
forall s (m :: * -&gt; *) a. (s -&gt; m (a, s)) -&gt; StateT s m a
</span><a href="Control.Monad.Trans.State.Lazy.html#StateT"><span class="hs-identifier hs-var">StateT</span></a></span><span> </span><span class="annot"><span class="annottext">((s -&gt; m (a, s)) -&gt; StateT s m a)
-&gt; (s -&gt; m (a, s)) -&gt; StateT s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679083531"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083531"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((a, s) -&gt; (a, s)) -&gt; m (a, s) -&gt; m (a, s)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679083530"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083530"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679083529"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083529"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679083530"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083531"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; s -&gt; s
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083529"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; m (a, s)
</span><a href="#local-6989586621679083533"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679083531"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Accum.html#accumToStateT"><span class="hs-pragma hs-type">accumToStateT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-293"></span></pre></body></html>